#include "Text.h"
#include "BaseD3D.h"
#include "GlobalUse.h"

VText::VText(void)
{
}

VText::~VText(void)
{
}

VText::VText(CString strText)
{    
	VBaseD3D* baseD3D = gfGetD3DBase();

	D3DXCreateFont(baseD3D->d3ddev,    // the D3D Device
                   30,    // font height of 30
                   0,    // default font width
                   FW_NORMAL,    // font weight
                   1,    // not using MipLevels
                   false,    // italic font
                   DEFAULT_CHARSET,    // default character set
                   OUT_DEFAULT_PRECIS,    // default OutputPrecision,
                   DEFAULT_QUALITY,    // default Quality
                   DEFAULT_PITCH | FF_DONTCARE,    // default pitch and family
                   L"Arial",    // use Facename Arial
                   &m_font);    // the font object

	m_strText = strText;
}

void VText::Draw() {
    // create a RECT to contain the text
	SetRect(&m_rectangle, 0, 0, 640, 480); 

    // draw the Hello World text
    m_font->DrawText(NULL,
                      m_strText,
					  m_strText.GetLength(),
                      &m_rectangle,
                      DT_CENTER | DT_VCENTER,
                      D3DCOLOR_ARGB(255, 255, 255, 255));
}

void VText::Release() {
	m_font->Release();
}

void VText::SetText(CString strText) {
	m_strText = strText;
}